<?php
			function __autoload($TenLop)
			{
				if (file_exists("classes/" . $TenLop . ".php"))
				{
					include "classes/" . $TenLop . ".php";
					return true;
				}
				if (file_exists("data/" . $TenLop . ".php"))
				{
					include "data/" . $TenLop . ".php";
					return true;
				}
				if (file_exists("control/" . $TenLop . ".php"))
				{
					include "control/" . $TenLop . ".php";
					return true;
				}
				return false;				
				
			}
		?>
<h3>Danh sách môn học</h3>
<form action="index.php?do=test2" method="POST">
	<table class="hocky_ma">
    	<tr>        	
            <td>
            	Học kỳ: <select name="hocky_ma">
                		<?php
                            $hocky = new hockycontroller();
                            $dshocky = $hocky->LayDanhSach();
                            
                            for($i = 0; $i < count($dshocky); $i++)
                            {       
                                    echo "<option value='{$dshocky[$i]['hocky_ma']}'>{$dshocky[$i]['hocky_ma']}</option>";
                            }
                    		?>
                		 </select>
                         
            </td>   
        </tr>
        <tr>
        	<td colspan="2"><input type="submit" value="Tìm" name="btnTim" /> </td>
        </tr>
    </table>
</form>
	
	
	<table border="1" width="400">
			
			<?php
				$hocky = new hockycontroller();
				if(isset($_POST['hocky_ma']))
					$hocky->hocky_ma = $_POST['hocky_ma'];
				$danhsach = $hocky->DanhSachMonHoc();
				
				if(isset($_POST['btnTim']))
					{
			?>	
							<tr>
                                <td width="43"><strong>Chọn</strong></td>
                                <td width="326"><strong>Tên Môn</strong></td>
                                <td width="49"><strong>Số TC</strong></td>
                                <td width="41"><strong>Nhóm</strong></td>
                                <td width="45"><strong>Còn lại</strong></td>
                                <td width="70"><strong>Số Lượng</strong></td>
                                <td width="68"><strong>TKB</strong></td>
                            </tr>
							<?php
								for($i = 0; $i < count($danhsach); $i++)
								{
							?>
                            	<tr>
                                <td><input type="checkbox" name="monhoc" id="monhoc" /></td>
                                <td><?php echo "{$danhsach[$i]['monhoc_ten']}"; ?></td>
                                <td><?php echo "{$danhsach[$i]['hocky_ten']}"; ?></td>
                                <td>2</td>
                                <td>40</td>
                                <td>50</td>
                                <td>Xem</td>
                              </tr>
                            <?php
								}
							?>
				
				<?php
					}
				?>
		</table>